package main

import (
	"natsmicro/conf"
	"sync"

	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/util/grand"
	"github.com/nats-io/stan.go"
)

var donewg sync.WaitGroup

func main() {

	ns, err := stan.Connect("test-cluster", "myI3D"+grand.Letters(3), stan.NatsURL(conf.NatsUrl))

	if err != nil {
		println(err.Error())
	}

	NN := 100
	var subs []stan.Subscription
	for i := 0; i < NN; i++ {
		sub1, _ := ns.QueueSubscribe("foo.*", "grouptest", func(m *stan.Msg) {
			g.Log().Info(m.Data)

		}, stan.StartWithLastReceived(), stan.DurableName("testdurableName"))
		subs = append(subs, sub1)

	}
	select {}

	ns.Close()
}
